package com.trkj.focusonzhuzhou.cityactivity;

import com.trkj.focusonzhuzhou.R;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class ImageFragment extends Fragment {

	private LinearLayout root;
	private ImageView ivChange;
	private int[] imgs = {R.drawable.img4, R.drawable.img3,
			R.drawable.img2, R.drawable.shen_long_cheng,
			R.drawable.img4
			};
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		if(root == null){
			
			root = (LinearLayout) inflater.inflate(R.layout.picture_change_items, null);
			ivChange = (ImageView) root.findViewById(R.id.pictrue_change_items);
			int resId = getArguments().getInt("resId");
			ivChange.setImageResource(imgs[resId]);
			
		}
		
		ViewGroup parent = (ViewGroup) root.getParent();
		
		if(parent != null){
			parent.removeAllViews();
		}
		
		return root;
	}
}
